﻿

--货主
CREATE TABLE OWNER(
	OWNER_ID varchar(20) NOT NULL,
	WH_ID varchar(20) ,
	COMPANY varchar(50) NULL,
	DESCRIPTION varchar(50) NULL,
	VAT varchar(20) NULL,
	CREDIT_LIMIT varchar(20) NULL,
	PO_ALPHA_PREFIX varchar(10) NOT NULL,
	ASN_ALPHA_PREFIX varchar(10) NOT NULL,
	SO_ALPHA_PREFIX varchar(10) NOT NULL,
	CITY varchar(50) NULL,
	STATE varchar(20) NULL,
	ZIP varchar(20) NULL,
	COUNTRY varchar(30) NULL,
	COUNTRY_CODE varchar(20) NULL,
	ADDRESS varchar(200) NULL,
	CONTACT1 varchar(30) NULL,
	CONTACT2 varchar(30) NULL,
	PHONE1 varchar(20) NULL,
	PHONE2 varchar(20) NULL,
	FAX1 varchar(20) NULL,
	FAX2 varchar(20) NULL,
	EMAIL1 varchar(60) NULL,
	EMAIL2 varchar(60) NULL,
	B_CITY varchar(50) NULL,
	B_STATE varchar(20) NULL,
	B_ZIP varchar(20) NULL,
	B_COUNTRY varchar(30) NULL,
	B_COUNTRY_CODE varchar(20) NULL,
	B_ADDRESS varchar(200) NULL,
	B_CONTACT1 varchar(30) NULL,
	B_CONTACT2 varchar(30) NULL,
	B_PHONE1 varchar(20) NULL,
	B_PHONE2 varchar(20) NULL,
	B_FAX1 varchar(20) NULL,
	B_FAX2 varchar(20) NULL,
	B_EMAIL1 varchar(60) NULL,
	B_EMAIL2 varchar(60) NULL,
	DEFAULT_CARTON_GROUP varchar(20) NOT NULL,
	DEFAULT_PACK_ID varchar(50) NOT NULL,
	DEFAULT_LOT_TEMPLATE_ID varchar(20) NULL,
	DEFAULT_PUTAWAY_RULE_ID varchar(20) NULL,
	DEFAULT_PREALLOCATE_RULE_ID varchar(20) NULL,
	DEFAULT_ALLOCATE_RULE_ID varchar(20) NULL,
	DEFAULT_ROTATION_RULE_ID varchar(20) NULL,
	CALCULATE_PUTAWAY_LOCATION varchar(20) NOT NULL,
	RECEIPT_VALIDATION_ID varchar(20) NOT NULL,
	DEFAULT_QC_LOC varchar(20) NOT NULL,
	DEFAULT_QC_LOC_OUT varchar(20) NOT NULL,
	DEFAULT_RETURNS_LOC varchar(20) NOT NULL,
	DEFAULT_PACKING_LOCATION varchar(20) NULL,
	UDF1 varchar(30) NULL,
	UDF2 varchar(30) NULL,
	UDF3 varchar(30) NULL,
	UDF4 varchar(30) NULL,
	UDF5 varchar(30) NULL,
	UDF6 varchar(30) NULL,
	UDF7 varchar(30) NULL,
	UDF8 varchar(30) NULL,
	UDF9 varchar(30) NULL,
	UDF10 varchar(30) NULL,
	REMARK varchar(2000) NULL,
	PACKING_VALIDATION_TEMPLATE varchar(20) NULL,
	ENABLE_OPP_XDOCK varchar(1) NULL,
	OPP_ORDER_STRATEGY_ID varchar(20) NULL,
	ALLOW_OVER_SHIPMENT varchar(1) NULL,
	APPORTION_RULE varchar(20) NULL,
	ORDER_DATE_START_DAYS int NULL,
	ORDER_DATE_END_DAYS int NULL,
	MAXIMUM_ORDERS int NULL,
	MINIMUM_PERCENT decimal(12, 6) NULL,
	ORDER_TYPE_RESTRICT01 varchar(20) NULL,
	ORDER_TYPE_RESTRICT02 varchar(20) NULL,
	ORDER_TYPE_RESTRICT03 varchar(20) NULL,
	ORDER_TYPE_RESTRICT04 varchar(20) NULL,
	ORDER_TYPE_RESTRICT05 varchar(20) NULL,
	ORDER_TYPE_RESTRICT06 varchar(20) NULL,
	ENABLE_PACKING_DEFAULT varchar(1) NULL,
	INSPECT_AT_PACK varchar(1) NULL,
	MULTI_ZONE_PL_PA varchar(1) NULL,
	CREATE_PA_TASK_ON_RF_RECEIPT varchar(20) NOT NULL,
	ORDER_BREAK_DEFAULT varchar(1) NOT NULL,
	LPN_BARCODE_SYMBOLOGY varchar(60) NULL,
	LPN_BARCODE_FORMAT varchar(60) NULL,
	LPN_LENGTH int NOT NULL,
	LPN_START_NUMBER varchar(20) NOT NULL,
	NEXT_LPN_NUMBER varchar(20) NOT NULL,
	LPN_ROLLBACK_NUMBER varchar(20) NOT NULL,
	CASE_LABEL_TYPE varchar(20) NOT NULL,
	APPLICATION_ID varchar(2) NOT NULL,
	SSCC_1ST_DIGIT int NOT NULL,
	UCC_VENDOR_NUMBER varchar(9) NOT NULL,
	CC_DISCREPANCY_RULE varchar(20) NOT NULL,
	CC_ADJ_BY_RF varchar(20) NOT NULL,
	CC_SKU_LOC varchar(20) NOT NULL,
	PI_SKU_LOC varchar(20) NOT NULL,
	ALLOW_COMMINGLED_LPN varchar(1) NOT NULL,
	ALLOW_AUTO_CLOSE_FOR_ASN varchar(1) NOT NULL,
	ALLOW_AUTO_CLOSE_FOR_PO varchar(1) NOT NULL,
	ALLOW_SYSTEM_GENERATED_LPN varchar(1) NOT NULL,
	ALLOW_SINGLE_SCANRECEIVING varchar(1) NOT NULL,
	BARCODE_CONFIG_ID varchar(20) NULL,
	TRACK_INVENTORY_BY varchar(1) NULL,
	DUP_CASE_ID varchar(1) NULL,
	SKU_SETUP_REQUIRED varchar(1) NOT NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(OWNER_ID)
 )
 go


 --供应商
 CREATE TABLE VENDOR
 (	
	VENDOR_ID varchar(20) NOT NULL,
	WH_ID varchar(20) ,
	COMPANY varchar(50) NULL,
	DESCRIPTION varchar(50) NULL,
	VAT varchar(20) NULL,
	CITY varchar(50) NULL,
	STATE varchar(20) NULL,
	ZIP varchar(20) NULL,
	COUNTRY varchar(30) NULL,
	COUNTRY_CODE varchar(20) NULL,
	ADDRESS varchar(200) NULL,
	CONTACT1 varchar(30) NULL,
	CONTACT2 varchar(30) NULL,
	PHONE1 varchar(20) NULL,
	PHONE2 varchar(20) NULL,
	FAX1 varchar(20) NULL,
	FAX2 varchar(20) NULL,
	EMAIL1 varchar(60) NULL,
	EMAIL2 varchar(60) NULL,
	B_CITY varchar(50) NULL,
	B_STATE varchar(20) NULL,
	B_ZIP varchar(20) NULL,
	B_COUNTRY varchar(30) NULL,
	B_COUNTRY_CODE varchar(20) NULL,
	B_ADDRESS varchar(200) NULL,
	B_CONTACT1 varchar(30) NULL,
	B_CONTACT2 varchar(30) NULL,
	B_PHONE1 varchar(20) NULL,
	B_PHONE2 varchar(20) NULL,
	B_FAX1 varchar(20) NULL,
	B_FAX2 varchar(20) NULL,
	B_EMAIL1 varchar(60) NULL,
	B_EMAIL2 varchar(60) NULL,
	UDF1 varchar(30) NULL,
	UDF2 varchar(30) NULL,
	UDF3 varchar(30) NULL,
	UDF4 varchar(30) NULL,
	UDF5 varchar(30) NULL,
	UDF6 varchar(30) NULL,
	UDF7 varchar(30) NULL,
	UDF8 varchar(30) NULL,
	UDF9 varchar(30) NULL,
	UDF10 varchar(30) NULL,
	REMARK varchar(2000) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(VENDOR_ID)
)
go

--客户
CREATE TABLE CUSTOMER(
	CUSTOMER_ID varchar(20) NOT NULL,
	WH_ID varchar(20) ,
	COMPANY varchar(50) NULL,
	DESCRIPTION varchar(50) NULL,
	VAT varchar(20) NULL,
	CITY varchar(50) NULL,
	STATE varchar(20) NULL,
	ZIP varchar(20) NULL,
	COUNTRY varchar(30) NULL,
	COUNTRY_CODE varchar(20) NULL,
	ADDRESS varchar(200) NULL,
	CONTACT1 varchar(30) NULL,
	CONTACT2 varchar(30) NULL,
	PHONE1 varchar(20) NULL,
	PHONE2 varchar(20) NULL,
	FAX1 varchar(20) NULL,
	FAX2 varchar(20) NULL,
	EMAIL1 varchar(60) NULL,
	EMAIL2 varchar(60) NULL,
	B_CITY varchar(50) NULL,
	B_STATE varchar(20) NULL,
	B_ZIP varchar(20) NULL,
	B_COUNTRY varchar(30) NULL,
	B_COUNTRY_CODE varchar(20) NULL,
	B_ADDRESS varchar(200) NULL,
	B_CONTACT1 varchar(30) NULL,
	B_CONTACT2 varchar(30) NULL,
	B_PHONE1 varchar(20) NULL,
	B_PHONE2 varchar(20) NULL,
	B_FAX1 varchar(20) NULL,
	B_FAX2 varchar(20) NULL,
	B_EMAIL1 varchar(60) NULL,
	B_EMAIL2 varchar(60) NULL,
	UDF1 varchar(30) NULL,
	UDF2 varchar(30) NULL,
	UDF3 varchar(30) NULL,
	UDF4 varchar(30) NULL,
	UDF5 varchar(30) NULL,
	UDF6 varchar(30) NULL,
	UDF7 varchar(30) NULL,
	UDF8 varchar(30) NULL,
	UDF9 varchar(30) NULL,
	UDF10 varchar(30) NULL,
	REMARK varchar(2000) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(CUSTOMER_ID)
)
go

--承运商
CREATE TABLE CARRIER(
	CARRIER_ID varchar(20) NOT NULL,
	WH_ID varchar(20) NULL,
	COMPANY varchar(50) NULL,
	DESCRIPTION varchar(50) NULL,
	VAT varchar(20) NULL,
	CITY varchar(50) NULL,
	STATE varchar(20) NULL,
	ZIP varchar(20) NULL,
	COUNTRY varchar(30) NULL,
	COUNTRY_CODE varchar(20) NULL,
	ADDRESS varchar(200) NULL,
	CONTACT1 varchar(30) NULL,
	CONTACT2 varchar(30) NULL,
	PHONE1 varchar(20) NULL,
	PHONE2 varchar(20) NULL,
	FAX1 varchar(20) NULL,
	FAX2 varchar(20) NULL,
	EMAIL1 varchar(60) NULL,
	EMAIL2 varchar(60) NULL,
	B_CITY varchar(50) NULL,
	B_STATE varchar(20) NULL,
	B_ZIP varchar(20) NULL,
	B_COUNTRY varchar(30) NULL,
	B_COUNTRY_CODE varchar(20) NULL,
	B_ADDRESS varchar(200) NULL,
	B_CONTACT1 varchar(30) NULL,
	B_CONTACT2 varchar(30) NULL,
	B_PHONE1 varchar(20) NULL,
	B_PHONE2 varchar(20) NULL,
	B_FAX1 varchar(20) NULL,
	B_FAX2 varchar(20) NULL,
	B_EMAIL1 varchar(60) NULL,
	B_EMAIL2 varchar(60) NULL,
	UDF1 varchar(30) NULL,
	UDF2 varchar(30) NULL,
	UDF3 varchar(30) NULL,
	UDF4 varchar(30) NULL,
	UDF5 varchar(30) NULL,
	UDF6 varchar(30) NULL,
	UDF7 varchar(30) NULL,
	UDF8 varchar(30) NULL,
	UDF9 varchar(30) NULL,
	UDF10 varchar(30) NULL,
	REMARK varchar(2000) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(CARRIER_ID)
)
go

--计费实体
CREATE TABLE BILLING_ENTITY
(	
	BILLING_ENTITY_ID varchar(20) NOT NULL,
	WH_ID varchar(20) NULL,
	COMPANY varchar(50) NULL,
	DESCRIPTION varchar(50) NULL,
	VAT varchar(20) NULL,
	CITY varchar(50) NULL,
	STATE varchar(20) NULL,
	ZIP varchar(20) NULL,
	COUNTRY varchar(30) NULL,
	COUNTRY_CODE varchar(20) NULL,
	ADDRESS varchar(200) NULL,
	CONTACT1 varchar(30) NULL,
	CONTACT2 varchar(30) NULL,
	PHONE1 varchar(20) NULL,
	PHONE2 varchar(20) NULL,
	FAX1 varchar(20) NULL,
	FAX2 varchar(20) NULL,
	EMAIL1 varchar(60) NULL,
	EMAIL2 varchar(60) NULL,
	B_CITY varchar(50) NULL,
	B_STATE varchar(20) NULL,
	B_ZIP varchar(20) NULL,
	B_COUNTRY varchar(30) NULL,
	B_COUNTRY_CODE varchar(20) NULL,
	B_ADDRESS varchar(200) NULL,
	B_CONTACT1 varchar(30) NULL,
	B_CONTACT2 varchar(30) NULL,
	B_PHONE1 varchar(20) NULL,
	B_PHONE2 varchar(20) NULL,
	B_FAX1 varchar(20) NULL,
	B_FAX2 varchar(20) NULL,
	B_EMAIL1 varchar(60) NULL,
	B_EMAIL2 varchar(60) NULL,
	UDF1 varchar(30) NULL,
	UDF2 varchar(30) NULL,
	UDF3 varchar(30) NULL,
	UDF4 varchar(30) NULL,
	UDF5 varchar(30) NULL,
	UDF6 varchar(30) NULL,
	UDF7 varchar(30) NULL,
	UDF8 varchar(30) NULL,
	UDF9 varchar(30) NULL,
	UDF10 varchar(30) NULL,
	REMARK varchar(2000) NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(BILLING_ENTITY_ID)
)
go



--PACK包装表
--PACK_UOM      单位
--QTY                  单位数量
--LENGTH_UOM 单位长度
--WIDTH_UOM   单位高度
--CUBE_UOM      单位体积
CREATE TABLE PACK
(
	PACK_ID varchar(50) NOT NULL,
	WH_ID varchar(30) NULL,
	DESCRIPTION varchar(100) NOT NULL,
	PACK_UOM1 varchar(20) NOT NULL,--基本单位  1
	QTY float NOT NULL,--基本数量  1
	LENGTH_UOM1 float NOT NULL, 
	WIDTH_UOM1 float NOT NULL,
	HEIGHT_UOM1 float NOT NULL,
	CUBE_UOM1 float NOT NULL,
	PACK_UOM2 varchar(20) NOT NULL,
	INNER_PACK float NOT NULL,--内包装数量 2
	LENGTH_UOM2 float NOT NULL,
	WIDTH_UOM2 float NOT NULL,
	HEIGHT_UOM2 float NOT NULL,
	CUBE_UOM2 float NOT NULL,
	PACK_UOM3 varchar(20) NOT NULL,
	CASE_CNT float NOT NULL,--箱数量  3
	LENGTH_UOM3 float NOT NULL,
	WIDTH_UOM3 float NOT NULL,
	HEIGHT_UOM3 float NOT NULL,
	CUBE_UOM3 float NOT NULL,
	PACK_UOM4 varchar(20) NOT NULL,
	PALLET float NOT NULL,--托数量 4
	LENGTH_UOM4 float NOT NULL,
	WIDTH_UOM4 float NOT NULL,
	HEIGHT_UOM4 float NOT NULL,
	CUBE_UOM4 float NOT NULL,
	PALLET_WOOD_LENGTH float NOT NULL,
	PALLET_WOOD_WIDTH float NOT NULL,
	PALLET_WOOD_HEIGHT float NOT NULL,
	PALLET_TI decimal(22, 5) NOT NULL,
	PALLET_HI decimal(22, 5) NOT NULL,
	PACK_UOM5 varchar(20) NOT NULL,
	CUBE float NOT NULL,--体积  5
	PACK_UOM6 varchar(20) NOT NULL,
	GROSS_WGT float NOT NULL,--毛重  6
	PACK_UOM7 varchar(20) NOT NULL,
	NET_WGT float NOT NULL,--净重  7
	PACK_UOM8 varchar(20) NULL,
	OTHER_UNIT1 float NOT NULL,--长度一  8
	LENGTH_UOM8 float NOT NULL,
	WIDTH_UOM8 float NOT NULL,
	HEIGHT_UOM8 float NOT NULL,
	PACK_UOM9 varchar(20) NOT NULL,
	OTHER_UNIT2 float NOT NULL,--长度二  9
	LENGTH_UOM9 float NOT NULL,
	WIDTH_UOM9 float NOT NULL,
	HEIGHT_UOM9 float NOT NULL,
	IS_CARTONIZE_UOM1 varchar(1) NOT NULL,
	IS_CARTONIZE_UOM2 varchar(1) NOT NULL,
	IS_CARTONIZE_UOM3 varchar(1) NOT NULL,
	IS_CARTONIZE_UOM4 varchar(1) NOT NULL,
	IS_CARTONIZE_UOM8 varchar(1) NOT NULL,
	IS_CARTONIZE_UOM9 varchar(1) NOT NULL,
	IS_REPLENISH_UOM1 varchar(1) NOT NULL,
	IS_REPLENISH_UOM2 varchar(1) NOT NULL,
	IS_REPLENISH_UOM3 varchar(1) NOT NULL,
	IS_REPLENISH_UOM4 varchar(1) NOT NULL,
	IS_REPLENISH_UOM8 varchar(1) NOT NULL,
	IS_REPLENISH_UOM9 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM1 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM2 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM3 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM4 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM8 varchar(1) NOT NULL,
	IS_IN_LABEL_UOM9 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM1 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM2 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM3 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM4 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM8 varchar(1) NOT NULL,
	IS_OUT_LABEL_UOM9 varchar(1) NOT NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	SYSTEM_CREATED varchar(1) NOT NULL,
	CREATED_BY varchar(20) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(20) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
PRIMARY KEY(PACK_ID)
)
go

/*
CREATE TABLE UOM(
	UOM_ID varchar(20) NOT NULL,
	WH_ID varchar(30) NULL,	
	UOM_DESCR varchar(50) NULL,
	UOM_TYPE varchar(20) NOT NULL,
	IS_ACTIVE varchar(1) NOT NULL,
	SYSTEM_CREATED varchar(1) NOT NULL,
	CREATED_BY varchar(18) NOT NULL,
	CREATED_DATE datetime NOT NULL,
	UPDATED_BY varchar(18) NOT NULL,
	UPDATED_DATE datetime NOT NULL,
	PRIMARY KEY(UOM_ID)
)
go

 */